import  React from 'react'
import  ReactDom from  'react-dom'
import {createStore,applyMiddleware,compose} from 'redux'
import  {product_index} from  './redux/product_index/product_index.redux'
import {Provider} from 'react-redux'
import thunk from 'redux-thunk'
import reducers from './reducer'
import {BrowserRouter,Route,Link,Switch,Redirect} from 'react-router-dom'
import  Index from  './containers/index/index'
import  Login from  './components/Login/login'

import Dashboard from './Dashboard'
const store=createStore(reducers,compose(
    applyMiddleware(thunk),
    window.devToolsExtension?window.devToolsExtension():f=>f
))


ReactDom.render(
    (<Provider store={store}>
        <BrowserRouter>
            <Switch>
                <Route path='/index' exact component={Index}></Route>
                <Route path='/dashboard' component={Dashboard}></Route>
                <Route path='/login' component={Login}></Route>
                <Redirect to='/index'></Redirect>
            </Switch>
        </BrowserRouter>
    </Provider>),
    document.getElementById('root')
)
